var config = require('../../config');
var mongoose = require('../../framework/mongoose');

var themeSchema = new mongoose.Schema({
    code: String,
    name: String,
    type: String,
    image: String,
    ordr: Number,

    status: Number,
    createTime: Date,
    updateTime: Date
}, config.schemaOptions);
var theme = mongoose.model('app_theme', themeSchema);
themeSchema.virtual('id').get(function() {
    return this._id;
});
exports.Theme = theme;

var skinSchema = new mongoose.Schema({
    code: String,
    type: String,
    ordr: Number,

    status: Number,
    createTime: Date,
    updateTime: Date,
    theme: { type: mongoose.Schema.Types.ObjectId, ref: 'theme' }
}, config.schemaOptions);
var skin = mongoose.model('app_skin', skinSchema);
skinSchema.virtual('id').get(function() {
    return this._id;
});
exports.Skin = skin;

var templateSchema = new mongoose.Schema({
    code: String,
    name: String,
    component: String,
    isDefault: { type: Boolean, ignoreIfNull: true },
    ordr: Number,

    status: Number,
    createTime: Date,
    updateTime: Date
}, config.schemaOptions);
var template = mongoose.model('app_template', templateSchema);
templateSchema.virtual('id').get(function() {
    return this._id;
});
exports.Template = template;